import matplotlib.pyplot as plt
import numpy as np

plt.figure(figsize=[12, 8])

scale = 5
plt_x = np.linspace(-scale, scale, int(np.floor(2 * scale * 10 + 1)))
plt_x_pos = np.linspace(0, scale, int(np.floor(scale * 10 + 1)))
plt_x_neg = np.linspace(-scale, 0, int(np.floor(scale * 10 + 1)))

# plt.scatter([0], np.exp([0]), 'r')
plt.plot(plt_x, plt_x**0, 'r--')
# plt.plot(plt_x, np.exp(plt_x), label='exp x')
# plt.plot(plt_x, np.exp(-plt_x), label='exp -x')
# plt.plot(plt_x, 1 + np.exp(-plt_x), label='1 + exp -x')
plt.plot(plt_x, 1.0 / (1 + np.exp(-plt_x)), label='1 / 1 + exp -x')
plt.plot(plt_x_pos, -np.log(1.0 / (1 + np.exp(-plt_x_pos))), label='train_h>0.5 -ln(1 / 1 + exp -x)')
plt.plot(plt_x_neg, -np.log(1.0 - 1 / (1 + np.exp(-plt_x_neg))), label='train_h<0.5 -ln(1 - 1 / 1 + exp -x)')

plt.legend()

ax = plt.gca()
ax.spines['top'].set_color('none')
ax.spines['right'].set_color('none')
ax.xaxis.set_ticks_position('bottom')
ax.yaxis.set_ticks_position('left')
ax.spines['bottom'].set_position(['data', 0])
ax.spines['left'].set_position(['data', 0])

plt.show()
